package com.cloudmusic;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Main {
    static {
        // IE浏览器   (webdriver.ie.driver)
        // 火狐浏览器 (webdriver.gecko.driver)
        // 谷歌浏览器 (webdriver.chrome.driver)
        System.setProperty("webdriver.chrome.driver", "C:\\Users\\58212\\Desktop\\chromedriver (1).exe");

//        System.setProperty("webdriver.chrome.driver", "C:\\Users\\58212\\AppData\\Local\\CentBrowser\\Application\\chrome.exe");
//        System.setProperty("webdriver.chrome.bin", "C:\\Users\\58212\\AppData\\Local\\CentBrowser\\Application\\chrome.exe");
    }

    /**
     * https://www.seleniumhq.org/download/
     * https://sites.google.com/a/chromium.org/chromedriver/downloads
     */
    public static void main(String[] args) {
         chrome();
    }

    public static void chrome() {
        WebDriver driver = null;
        try {
            driver = new ChromeDriver();

            driver.get("https://www.baidu.com/");

            Thread.sleep(5000);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (driver != null) {
                // 关闭浏览器当前窗口
                driver.close();
                // 退出 webdriver 并关闭浏览器
                driver.quit();
            }
        }
    }

}
